home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / wgdb-42.lha / wgdb-4.2 / gdb / language.h < prev    next >
C/C++ Source or Header  |  1992-09-11  |  7KB  |  171 lines

  1. /* Source-language-related definitions for GDB.
  2.    Copyright 1991 Free Software Foundation, Inc.
  3.    Contributed by the Department of Computer Science at the State University
  4.    of New York at Buffalo.
  5.  
  6. This file is part of GDB.
  7.  
  8. This program is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 2 of the License, or
  11. (at your option) any later version.
  12.  
  13. This program is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. GNU General Public License for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with this program; if not, write to the Free Software
  20. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  21.  
  22. /* This used to be included to configure GDB for one or more specific
  23.    languages.  Now it is shortcutted to configure for all of them.  FIXME.  */
  24. /* #include "lang_def.h" */
  25. #define    _LANG_c
  26. #define    _LANG_m2
  27.  
  28. /* range_mode ==
  29.    range_mode_auto:   range_check set automatically to default of language.
  30.    range_mode_manual: range_check set manually by user.  */
  31.  
  32. extern enum range_mode {range_mode_auto, range_mode_manual} range_mode;
  33.  
  34. /* range_check ==
  35.    range_check_on:    Ranges are checked in GDB expressions, producing errors.
  36.    range_check_warn:  Ranges are checked, producing warnings.
  37.    range_check_off:   Ranges are not checked in GDB expressions.  */
  38.  
  39. extern enum range_check
  40.   {range_check_off, range_check_warn, range_check_on} range_check;
  41.  
  42. /* type_mode ==
  43.    type_mode_auto:   type_check set automatically to default of language
  44.    type_mode_manual: type_check set manually by user. */
  45.  
  46. extern enum type_mode {type_mode_auto, type_mode_manual} type_mode;
  47.  
  48. /* type_check ==
  49.    type_check_on:    Types are checked in GDB expressions, producing errors.
  50.    type_check_warn:  Types are checked, producing warnings.
  51.    type_check_off:   Types are not checked in GDB expressions.  */
  52.  
  53. extern enum type_check
  54.   {type_check_off, type_check_warn, type_check_on} type_check;
  55.  
  56. /* Structure tying together assorted information about a language.  */
  57.  
  58. struct language_defn {
  59.   char *       la_name;        /* Name of the language */
  60.   enum language    la_language;        /* its symtab language-enum (defs.h) */
  61.   struct type ** const
  62.           *la_builtin_type_vector;  /* Its builtin types */
  63.   enum range_check la_range_check;    /* Default range checking */
  64.   enum type_check  la_type_check;    /* Default type checking */
  65.   int         (*la_parser)();    /* Parser function */
  66.   void         (*la_error)();        /* Parser error function */
  67.   struct type     **la_longest_int;    /* Longest signed integral type */
  68.   struct type     **la_longest_unsigned_int; /* Longest uns integral type */
  69.   struct type     **la_longest_float;    /* Longest floating point type */
  70.   char          *la_hex_format;    /* Hexadecimal printf format str */
  71.   char          *la_hex_format_pre;    /* Prefix for custom format string */
  72.   char          *la_hex_format_suf;    /* Suffix for custom format string */
  73.   char          *la_octal_format;    /* Octal printf format str */
  74.   char          *la_octal_format_pre;    /* Prefix for custom format string */
  75.   char          *la_octal_format_suf;    /* Suffix for custom format string */
  76. const struct op_print
  77.           *la_op_print_tab;    /* Table for printing expressions */
  78. /* Add fields above this point, so the magic number is always last. */
  79.   long            la_magic;        /* Magic number for compat checking */
  80. };
  81.  
  82. #define LANG_MAGIC    910823L
  83.  
  84. /* Pointer to the language_defn for our current language.  This pointer
  85.    always points to *some* valid struct; it can be used without checking
  86.    it for validity.  */
  87.  
  88. extern struct language_defn *current_language;
  89.  
  90. /* language_mode == 
  91.    language_mode_auto:   current_language automatically set upon selection
  92.              of scope (e.g. stack frame)
  93.    language_mode_manual: current_language set only by user.  */
  94.  
  95. extern enum language_mode
  96.   {language_mode_auto, language_mode_manual} language_mode;
  97.  
  98. /* These macros define the behaviour of the expression 
  99.    evaluator.  */
  100.  
  101. /* Should we strictly type check expressions? */
  102. #define STRICT_TYPE (type_check != range_check_off)
  103.  
  104. /* Should we range check values against the domain of their type? */
  105. #define RANGE_CHECK (range_check != type_check_off)
  106.  
  107. /* "cast" really means conversion */
  108. /* FIXME -- should be a setting in language_defn */
  109. #define CAST_IS_CONVERSION (current_language->la_language == language_c)
  110.  
  111. void language_info();
  112. void set_language();
  113.  
  114. /* This page contains functions that return things that are
  115.    specific to languages.  Each of these functions is based on
  116.    the current setting of working_lang, which the user sets
  117.    with the "set language" command. */
  118.  
  119. /* Returns some built-in types */
  120. #define    longest_int()        (*current_language->la_longest_int)
  121. #define    longest_unsigned_int()    (*current_language->la_longest_unsigned_int)
  122. #define    longest_float()        (*current_language->la_longest_float)
  123. struct type *binop_result_type();
  124.  
  125. /* Hexadecimal number formatting is in defs.h because it is so common
  126.    throughout GDB.  */
  127.  
  128. /* Return a format string for printf that will print a number in the local
  129.    (language-specific) octal format.  Result is static and is
  130.    overwritten by the next call.  local_octal_format_custom takes printf
  131.    options like "08" or "l" (to produce e.g. %08x or %lx).  */
  132.  
  133. #define local_octal_format() (current_language->la_octal_format)
  134. char *local_octal_format_custom();
  135.  
  136. /* Type predicates */
  137. int simple_type();
  138. int ordered_type();
  139. int same_type();
  140. int integral_type();
  141. int numeric_type();
  142. int character_type();
  143. int boolean_type();
  144. int float_type();
  145. int pointer_type();
  146. int structured_type();
  147.  
  148. /* Checks Binary and Unary operations for semantic type correctness */
  149. void binop_type_check();
  150. #define unop_type_check(v,o) binop_type_check((v),NULL,(o))
  151.  
  152. /* Error messages */
  153. void op_error();
  154. #define type_op_error(f,o) \
  155.    op_error((f),(o),type_check==type_check_on ? 1 : 0)
  156. #define range_op_error(f,o) \
  157.    op_error((f),(o),range_check==range_check_on ? 1 : 0)
  158. void type_error();
  159. void range_error();
  160.  
  161. /* Data:  Does this value represent "truth" to the current language?  */
  162. int value_true();
  163.  
  164. /* Misc:  The string representing a particular enum language.  */
  165. char *language_str();
  166.  
  167. /* Add a language to the set known by GDB (at initialization time).  */
  168. void add_language ();        /* Arg is &language_defn */
  169.  
  170. extern enum language get_frame_language ();    /* In stack.c */
  171.